import {EventEmitter, Injectable} from '@angular/core';
import { Http, Response} from '@angular/http';
import 'rxjs/Rx';
import { Observable } from 'rxjs/Observable';

@Injectable()

export class SliderService {
  currentIndexChanged = new EventEmitter<number>();
  currentIndex: number;
  totalNumber: number;
  constructor(private http: Http) {}
  getImages() {
    return this.http.get('/assets/data/slider.json');
      // .map(
      //   (response: Response) => {
      //     const data = response.json();
          // for (const server of data) {
          //   server.name = 'FETCHED_' + server.name;
          // }
          // this.totalNumber = data.data.images.length;
          // return data;
        // }
      // )
      // .catch(
      //   (error: Response) => {
      //     return Observable.throw('Something went wrong');
      //   }
      // );
  }


}

